import type { App } from 'vue'
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'

const routes: RouteRecordRaw[] = [
  {
    path: '/aiAssistant',
    name: 'aiAssistant',
    component: () => import('@/views/aiAssistant/index.vue'),
    meta: {
      title: 'AI助手'
    }
  },
  {
    path: '/aiChatFrameHead',
    name: 'aiChatFrameHead',
    component: () => import('@/views/aiChat/index.vue'),
    meta: {
      title: 'AI助手头部'
    }
  },
  {
    path: '/screenRecorder',
    name: 'ScreenRecorder',
    component: () => import('@/views/screenRecorder/index.vue'),
     meta: {
      title: '录屏'
    }
  },
  {
    path: '/discussionGroup',
    name: 'discussionGroup',
    component: () => import('@/views/discussionGroup/index.vue'),
     meta: {
      title: '加入交流群'
    }
  },
  {
    path: '/moreFeatures',
    name: 'moreFeatures',
    component: () => import('@/views/moreFeatures/index.vue'),
     meta: {
      title: '更多功能'
    }
  },
  {
    path: '/rightClickMenu',
    name: 'rightClickMenu',
    component: () => import('@/views/rightClickMenu/index.vue'),
     meta: {
      title: '右键菜单'
    }
  },
  {
    path: '/browserView',
    name: 'browserView',
    component: () => import('@/views/browserView/index.vue'),
    meta: {
      title: '浏览器视图'
    }
  },
  {
    path: '/settings',
    name: 'settings',
    component: () => import('@/views/settings/index.vue'),
    meta: {
      title: '设置'
    }
  },
  {
    path: '/userManagement',
    name: 'userManagement',
    redirect: '/userManagement/userGroup',
    component: () => import('@/views/userManagement/index.vue'),
    meta: {
      title: '用户管理'
    },
    children: [
      {
        path: '/userManagement/userGroup',
        name: 'userGroup',
        component: () => import('@/views/userManagement/userGroup/index.vue'),
        meta: {
          title: '用户组'
        },
      },
      {
        path: '/userManagement/permissionManagement',
        name: 'permissionManagement',
        component: () => import('@/views/userManagement/permissionManagement/index.vue'),
        meta: {
          title: '权限管理'
        },
      }
    ]
  },
  
]

const router = createRouter({
  history: createWebHashHistory(), // #
  routes
})

export function setupRouter(app: App): void {
  app.use(router)
}

export default router
